package cn.kgc.tangcco.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @author 李昊哲
 * @Description
 * @create 2020/10/19 下午4:09
 */
// @WebFilter(urlPatterns = {"*.jsp","*.do"})
public class Lifecycle implements Filter {
    public Lifecycle() {
        System.out.println("老丈人定状");
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("老丈人出场");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("爱你");
        // 放行
        filterChain.doFilter(servletRequest,servletResponse);
    }

    @Override
    public void destroy() {
        System.out.println("老丈人不带走一片云彩");
    }
}
